package com.zhuozhou.jdyc.enumbean;

import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;

import com.zhuozhou.jdyc.R;
import com.zhuozhou.jdyc.main.main.bean.MenuItemBean;
import com.zhuozhou.jdyc.main.menu.activity.TestActivity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 方舟 on 2019/9/2.
 * 首页菜单栏
 */
public enum IndexItemMenuEnum {
    /**
     * 首页菜单
     */
    VIEWPAGER(R.mipmap.ic_launcher, R.string.index_offspring, "100", TestActivity.class,30000);

    // 成员变量
    private @StringRes
    int strRes;
    private @DrawableRes
    int imgRes;
    private String tag;//此处tag类似于id的功能，后期可能要用来做排序等
    private Class<?> clx;
    private int requestCode = 0;

    // 构造方法
    private IndexItemMenuEnum(@DrawableRes int imgRes, @StringRes int strRes, String tag) {
        this.strRes = strRes;
        this.imgRes = imgRes;
        this.tag = tag;
    }

    // 构造方法
    private IndexItemMenuEnum(@DrawableRes int imgRes, @StringRes int strRes, String tag, Class<?> clx, int requestCode) {
        this.strRes = strRes;
        this.imgRes = imgRes;
        this.tag = tag;
        this.clx = clx;
        this.requestCode = requestCode;
    }

    public Class<?> getClx() {
        return clx;
    }

    public void setClx(Class<?> clx) {
        this.clx = clx;
    }

    public int getRequestCode() {
        return requestCode;
    }

    public void setRequestCode(int requestCode) {
        this.requestCode = requestCode;
    }

    public int getStrRes() {
        return strRes;
    }

    public void setStrRes(int strRes) {
        this.strRes = strRes;
    }

    public int getImgRes() {
        return imgRes;
    }

    public void setImgRes(int imgRes) {
        this.imgRes = imgRes;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public static List<MenuItemBean> toList() {
        List<MenuItemBean> list = new ArrayList<>();
        for (IndexItemMenuEnum jobItemMenuEnum : IndexItemMenuEnum.values()) {
            list.add(new MenuItemBean(jobItemMenuEnum.getImgRes(), jobItemMenuEnum.getStrRes(),
                    jobItemMenuEnum.getTag(), jobItemMenuEnum.getClx(), jobItemMenuEnum.getRequestCode()));
        }
        return list;
    }

}
